$(document).ready(function() {

	$("#settingsForm").validate({
		rules:{
			firstName:{required:true, maxlength: 20},
			lastName:{required:true, maxlength: 20}
		},
		
		messages:{
			firstName:{
				required:"First name can not be empty",
				maxlength:"Too long first name"},
			lastName:{
				required:"Last name can not be empty",
				maxlength:"Too long last name"}	
		},
	
		errorClass: "help-inline",
		errorElement: "span",
		
		highlight:function(element, errorClass, validClass) {
			$(element).parents('.control-group').addClass('error');
			$(element).parents('.control-group').removeClass('success');
		},
		unhighlight: function(element, errorClass, validClass) {
			$(element).parents('.control-group').removeClass('error');
			$(element).parents('.control-group').addClass('success');
		}
	});
});